package gui;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.RoundedRectangle;

public class Alert extends GUIEvent {
	
	private String message;
	private Color color_message;
	private Color background;
	
	public Alert(String m,float x,float y,Color col_m,Color backg,int startAt){
		super(x,y,startAt);
		message = m;
		color_message = col_m;
		background = backg;
	}
	
	@Override
	public void render(Graphics g){
		Color originalcolor = g.getColor();
		int size = message.length() * 12;
		RoundedRectangle rr = new RoundedRectangle(x,y,size,40,50f);
		
		g.setColor(background);
		g.fillRoundRect(x,y,size,40,50);

		g.setColor(color_message);
		g.drawString(message, rr.getMinX() + (rr.getHeight()/2), (rr.getMinY()) + (rr.getHeight()/2) - 10);
		
		g.setColor(originalcolor);		
	}
	
	@Override
	public void setString(String m){
		message = m;
	}
}
